[----------------------------------------]
[-     Scrolling EDSAC logo program     -]
[----------------------------------------]
[-           by James Lingard           -]
[-            February 2000             -]
[----------------------------------------]
[- Scrolls a credits message from right -]
[- to left around tank 0                -]
[----------------------------------------]


[----------------------------------------]
[-           Code letter data           -]
[----------------------------------------]
T 44 K  [starts loading at address 44]

P 512 F [code letter ! - used to generate EDSAC logo data correctly]
P 768 F [code letter H -   "   "     "      "     "    "      "    ]
P 896 F [code letter N -   "   "     "      "     "    "      "    ]
P 960 F [code letter M -   "   "     "      "     "    "      "    ]
P 992 F [code letter & -   "   "     "      "     "    "      "    ]

P 512 F [code letter L - base address of the EDSAC logo data]
P 160 F [code letter X - base address of the constant / variable data pool]
P 192 F [code letter G - base address of the data correction list]


[----------------------------------------]
[-             Main routine             -]
[----------------------------------------]
T 64 K  [starts loading at address 64 - start of tank 2]
G K     [store the @ code letter]

[----------------------]
[- prepare EDSAC logo -]
[----------------------]

[- load the list entry and jump if we've reached the end of the list -]
[00] A 0 G
[01] G 14 @

[- modify the data access instructions -]
[02] A 9 @
[03] U 9 @
[04] A 2 X
[05] T 8 @

[- add in the middle bit -]
[06] A 0 #X
[07] L D
[08] A 0 #L
[09] T 0 #L

[- increment the list index instructions -]
[10] A 23 X
[11] A 0 @
[12] T 0 @
[13] E 0 @

[--------------------------------]
[- start of main scrolling loop -]
[--------------------------------]

[---------------------------------------------]
[- at the beginning of a cycle,              -]
[- copy the whole screen to tank 0 and pause -]
[---------------------------------------------]

[- compare instruction 70 with the value A 480 #L to see -]
[- if we are at the start of a cycle                     -]
[14] S 11 X

[- if not at the start of a cycle, skip the next section -]
[15] E 33 @

[--------------]
[- delay loop -]
[--------------]

[- prepare accumulator -]
[16] S 13 X

[- busy delay loop -]
[17] A 14 X
[18] G 17 @

[-----------------------]
[- copy logo to tank 0 -]
[-----------------------]

[- reset the self-modifying code -]
[19] A 15 X
[20] T 24 @
[21] A 18 X
[22] T 25 @

[- copy a double word from the back memory to tank 0 -]
[23] T 12 X
[24] P F     [modifiable]
[25] P F     [modifiable]

[- increment the data transfer instructions -]
[26] A 25 @
[27] A 8 X
[28] U 25 @

[29] A 3 X
[30] U 24 @

[- loop if not at the end of the screen -]
[31] S 19 X
[32] G 23 @

[--------------------------------------------]
[- scroll along one line of the back memory -]
[--------------------------------------------]

[- clear the accumulator -]
[33] T 12 X

[- load the multiplier -]
[34] H 6 #X

[- right shift the first tank and store in 16 -]
[35] A 0 #L   [modifiable]
[36] R F
[37] R F
[38] R 4 F
[39] T 4 #X
[40] C 4 #X
[41] T 16 #X

[-----------------------]
[- start of inner loop -]
[-----------------------]

[- clear the accumulator -]
[42] T 12 X

[- left shift the nth tank and store -]
[43] A 0 #L   [modifiable]
[44] L D
[45] T 0 #L   [modifiable]

[- right shift the (n+1)th tank and add it into the nth tank -]
[46] A 32 #L  [modifiable]
[47] R F
[48] R F
[49] R 4 F
[50] T 4 #X
[51] C 4 #X
[52] A 0 #L   [modifiable]
[53] T 0 #L   [modifiable]

[-------------------------]
[- modify the inner loop -]
[-------------------------]

[- modify the T 0 #L instructions -]
[54] A 45 @
[55] A 10 X

[56] U 45 @
[57] T 53 @

[- modify the A 0 #L instructions -]
[58] A 43 @
[59] A 10 X

[60] U 43 @
[61] U 52 @

[- store the A 32 #L instruction -]
[62] A 10 X
[63] U 46 @

[- check to see if inner loop is done - if not, repeat -]
[64] S 20 X
[65] G 42 @

[---------------------]
[- end of inner loop -]
[---------------------]

[- clear the accumulator -]
[66] T 12 X

[- restore the (first) T 0 #L inner loop orders -]
[67] H 21 X
[68] C 45 @
[69] T 45 @

[- left shift the last tank, add it to the contents of 16 and store -]

[70] A 480 #L [modifiable]
[71] L D
[72] A 16 #X
[73] T 480 #L [modifiable]

[-----------------------------------------------------]
[- modify the scrolling loop to scroll the next line -]
[-----------------------------------------------------]

[- load the multiplier -]
[74] H 9 X

[- modify the T 0 #L instructions -]
[75] A 45 @
[76] A 8 X
[77] T 45 @
[78] C 45 @

[79] U 45 @
[80] U 53 @

[- store the T 480 #L instruction -]
[81] A 22 X

[82] T 73 @

[- modify the A 0 #L instructions -]
[83] A 35 @
[84] A 8 X
[85] T 35 @
[86] C 35 @

[87] U 35 @
[88] U 43 @
[89] U 52 @

[- store the A 32 #L instruction -]
[90] A 10 X

[91] T 46 @

[- store the A 480 #L instruction -]
[92] A 35 @
[93] A 22 X
[94] U 70 @

[-------------------------------------------]
[- jump back to the start of the main loop -]
[-------------------------------------------]

[95] G 14 @  [jump back to start of main loop]


[----------------------------------------]
[-     Constants and temporary data     -]
[----------------------------------------]
T 160 K  [starts loading at address 160 - start of tank 5]

[00] . F  P F  [constant - only the bit below the middle bit set]

[02] M F       [constant - used on line (near start)]
[03] M 512 F   [constant - used on line 029]

[04] P F  P F  [variable - used while rotating a line]

[06] P D  P F  [constant - has value 1D]

[08] P 2 F     [constant - has value 2A]
[09] V 991 D   [constant - all bits set except for the 32-bit in the address]

[10] P 32 F    [constant - only the 32-bit in the address set]
[11] A 481 L   [constant - used on line 012]

[12] P F       [rubbish - used as destination for clearing the accumulator]
[13] P 0 F     [constant - amount of delay]

[14] P D       [constant - has value 1]
[15] A 0 #L    [constant - used on line 018]

[16] P F  P F  [variable - used while rotating a line]

[18] T 0 D     [constant - used on line 020]
[19] A 32 #L   [constant - used on line 031]

[20] A 512 !   [constant - used on line 064]
[21] T 543 D   [constant - used on line 067]

[22] P 480 F   [constant - has value 480A]
[23] P 1 F     [constant - has value 1A]


[----------------------------------------]
[-       Data correction list           -]
[----------------------------------------]
T 192 K  [starts loading at address 192 - start of tank 6]

[00] P 40 F    [address 40]
[01] P 6 F     [address 46]
[02] P 6 F     [address 52]
[03] P 20 F    [address 72]
[04] P 2 F     [address 74]
[05] P 2 F     [address 76]
[06] P 2 F     [address 78]
[07] P 158 F   [address 236]

[08] A 480 #L  [list terminator]


[----------------------------------------]
[-           EDSAC logo data            -]
[----------------------------------------]
T 512 K  [starts loading at address 256 - start of tank 16]

[- tank 16 -]
[000] P F      P F
[002] P F      P F
[004] P F      P F
[006] P F      P F
[008] P F      P F
[010] P F      P F
[012] P F      P F
[014] P F      P F
[016] P F      P F
[018] P F      P F
[020] P F      P F
[022] P F      P F
[024] P F      P F
[026] P F      P F
[028] P F      P F
[030] P F      P F

[- tank 17 -]
[- EDSAC -]
[032] P F      P F
[034] P F      P F
[036] P F      P F
[038] P F      P F
[040] F 143 F  * 753 #!
[042] O 144 F  I 136 F
[044] O 144 F  I 136 F
[046] F 976 M  * 136 D
[048] Q 144 F  I 137 F
[050] Q 144 F  I 137 F
[052] & 911 N  * 752 #!
[054] P F      P F
[056] P F      P F
[058] P F      P F
[060] P F      P F
[062] P F      P F

[- tank 18 -]
[- Simula -]
[064] P F      P F
[066] P F      P F
[068] P F      P F
[070] P F      P F
[072] O 934 #N P 969 M
[074] O 293 D  P 73 F
[076] O 292 D  P 73 F
[078] L 295 D  P 905 D
[080] P 32 F   P 512 !
[082] P 32 F   P 520 !
[084] P 32 F   P 960 F
[086] P F      P F
[088] P F      P F
[090] P F      P F
[092] P F      P F
[094] P F      P F

[- tank 19 -]
[- tor -]
[096] P F      P F
[098] P F      P F
[100] P F      P F
[102] P F      P F
[104] P F      R 976 M
[106] P F      R 656 !
[108] P F      R 656 !
[110] P F      R 988 M
[112] P F      K F
[114] P F      R F
[116] P F      R F
[118] P F      P F
[120] P F      P F
[122] P F      P F
[124] P F      P F
[126] P F      P F

[- tank 20 -]
[- by G -]
[128] P F      P F
[130] P 960 F  P F
[132] P 576 F  P F
[134] P 64 F   P F
[136] C 960 F  P F
[138] @ 576 D  P F
[140] @ 576 D  P F
[142] C 576 D  P F
[144] . D      P F
[146] . D      P F
[148] . F      P F
[150] P F      P F
[152] P F      P F
[154] P F      P F
[156] P F      P F
[158] P F      P F

[- tank 21 -]
[- Group N -]
[160] P F      P F
[162] P 512 F  P F
[164] P 512 F  P F
[166] P 512 F  P F
[168] C 960 D  A 271 F
[170] @ 576 D  W 265 F
[172] @ 576 D  W 265 F
[174] @ 960 D  U 463 F
[176] P D      P F
[178] P D      P F
[180] P D      C F
[182] P F      P F
[184] P F      P F
[186] P F      P F
[188] P F      P F
[190] P F      P F

[- tank 22 -]
[- Novemb -]
[192] P F      P F
[194] P F      P F
[196] P F      P F
[198] P F      P F
[200] C 679 D  W 966 F
[202] & 676 D  W 585 F
[204] ! 676 D  Y 585 F
[206] C 999 D  J 969 F
[208] P 4 F    @ F
[210] P 4 F    W F
[212] P 4 F    W F
[214] P F      P F
[216] P F      P F
[218] P F      P F
[220] P F      P F
[222] P F      P F

[- tank 23 -]
[- er - H -]
[224] P F      P F
[226] P F      P F
[228] P F      P F
[230] P F      P F
[232] P 17 F   U 640 !
[234] P 17 F   Y 128 F
[236] V 17 F   T 128 F
[238] P 31 F   U 736 !
[240] P 17 F   P F
[242] P 17 F   P F
[244] P 17 F   P F
[246] P F      P F
[248] P F      P F
[250] P F      P F
[252] P F      P F
[254] P F      P F

[- tank 24 -]
[- anna, T -]
[256] P F      P F
[258] P F      P F
[260] P F      P F
[262] P 512 F  P F
[264] Z 258 F  Z 292 D
[266] # 2 F    # 292 D
[268] O 2 F    O 292 D
[270] * 2 F    * 455 F
[272] P 2 F    P F
[274] P 2 F    P F
[276] P 15 D   P F
[278] P F      P F
[280] P F      P F
[282] P F      P F
[284] P F      P F
[286] P F      P F

[- tank 25 -]
[- om, Lio -]
[288] P F      P F
[290] P F      P F
[292] P F      P F
[294] P F      P 4 F
[296] U 847 H  * 338 F
[298] R 73 F   O 336 F
[300] R 73 F   O 336 F
[302] R 79 F   * 496 F
[304] R F      P F
[306] R 64 F   P F
[308] R F      P F
[310] P F      P F
[312] P F      P F
[314] P F      P F
[316] P F      P F
[318] P F      P F

[- tank 26 -]
[- nel, Sim -]
[320] P F      P F
[322] P F      P F
[324] P F      P F
[326] P F      P 1 F
[328] Q 914 #N O 484 D
[330] P 146 D  O 388 F
[332] P 146 D  O 324 F
[334] P 915 #N K 484 F
[336] Q F      P 4 F
[338] Q 16 F   P 4 F
[340] P 960 M  P 4 F
[342] P F      P F
[344] P F      P F
[346] P F      P F
[348] P F      P F
[350] P F      P F

[- tank 27 -]
[- mon, Stu -]
[352] P F      P F
[354] P F      P F
[356] P F      P F
[358] P F      P 1 F
[360] Q 915 #N O 932 #N
[362] P 146 F  O 292 F
[364] P 146 F  O 292 F
[366] P 914 N  L 952 N
[368] Q 56 F   P F
[370] Q 16 F   P F
[372] P 976 M  P F
[374] P F      P F
[376] P F      P F
[378] P F      P F
[380] P F      P F
[382] P F      P F

[- tank 28 -]
[- uart & O -]
[384] P F      P F
[386] P F      P F
[388] P F      P F
[390] P F      P F
[392] Q 896 #H D 578 F
[394] W 257 F  @ 834 H
[396] Q 641 F  @ 578 F
[398] P 513 !  D 882 H
[400] Q 513 F  P 7 F
[402] W 257 F  P 2 F
[404] Q 768 #H P 2 F
[406] P F      P F
[408] P F      P F
[410] P F      P F
[412] P F      P F
[414] P F      P F

[- tank 29 -]
[- Oli -]
[416] P F      P F
[418] P F      P F
[420] P F      P F
[422] P F      P F
[424] P F      & 640 !
[426] P F      R 640 !
[428] P F      R 640 !
[430] P F      R 640 !
[432] P F      R 512 !
[434] P F      R 640 !
[436] P F      & 512 !
[438] P F      P F
[440] P F      P F
[442] P F      P F
[444] P F      P F
[446] P F      P F

[- tank 30 -]
[448] P F      P F
[450] P F      P F
[452] P F      P F
[454] P F      P F
[456] P F      P F
[458] P F      P F
[460] P F      P F
[462] P F      P F
[464] P F      P F
[466] P F      P F
[468] P F      P F
[470] P F      P F
[472] P F      P F
[474] P F      P F
[476] P F      P F
[478] P F      P F

[- tank 31 -]
[480] P F      P F
[482] P F      P F
[484] P F      P F
[486] P F      P F
[488] P F      P F
[490] P F      P F
[492] P F      P F
[494] P F      P F
[496] P F      P F
[498] P F      P F
[500] P F      P F
[502] P F      P F
[504] P F      P F
[506] P F      P F
[508] P F      P F
[510] P F      P F


[----------------------------------------]
[-     Directives to initial orders     -]
[----------------------------------------]
E Z     [begin execution at address 64]
P F
